package com.xiaotao.controller;

import com.xiaotao.entity.Good;
import com.xiaotao.service.GoodService;
import com.xiaotao.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("good")
public class GoodController {
    @Autowired
    private GoodService goodService;
    @GetMapping
    public Result findOnLine() throws Exception {
        return goodService.findOnLine();
    }
    @GetMapping("/{id}")
    public Result findById(@PathVariable Integer id){
        return goodService.findById(id);
    }
    @PutMapping
    public Result updateBuyNum(@RequestBody Good good){
        return goodService.updateBuyNum(good);
    }
}
